//
//  ViewController.m
//  UI20_NSURLSession
//
//  Created by 李劲成 on 16/4/6.
//  Copyright © 2016年 ljc. All rights reserved.
//

#import "ViewController.h"
#import "NetworkHandler.h"
#import "NetworkHandlerV2.h"
@interface ViewController () <NetworkHandlerDelegate, NetworkHandlerV2Delegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    [self handleData];
    [self handleDataV2];
    // Do any additional setup after loading the view, typically from a nib.
}

#pragma mark - 网络请求
/** 详见 NetworkHandler 类文件. */
- (void)handleData {
    [NetworkHandler networkHanlerJSONWithURL:@"http://mobile.ximalaya.com/m/explore_album_list?category_name=all&condition=hot&device=android&page=1&per_page=20&status=0&tag_name=%E5%8D%81%E4%BA%8C%E6%98%9F%E5%BA%A7" delegate:self];
}

#pragma mark - NetworkHandler Delegate
- (void)didFinishCompletion:(id)result {
    // 线程1 , 主线程
    NSLog(@"%@", [NSThread currentThread]);
    NSLog(@"%@", result);

}

- (void)handleDataV2 {
    [NetworkHandlerV2 networkHandlerV2WithURL:@"http://mobile.ximalaya.com/m/explore_album_list?category_name=all&condition=hot&device=android&page=1&per_page=20&status=0&tag_name=%E5%8D%81%E4%BA%8C%E6%98%9F%E5%BA%A7" delegate:self];
}

- (void)didFinishV2Completion:(id)result {
    NSLog(@"%@", [NSThread currentThread]);
    NSLog(@"%@", result);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
